import Vue from 'vue'
import Router from 'vue-router'
import Login from '../components/Login.vue'
import Home from '../components/Home.vue'
import Welcome from '../components/Welcome.vue'
import Users from '../components/menu/user/Users.vue'
import Orders from '../components/menu/order/Orders.vue'
import Record from '../components/menu/record/Reports.vue'
import Categories from '../components/menu/goods/Categories.vue'
import Goods from '../components/menu/goods/Goods.vue'
import Params from '../components/menu/goods/Params.vue'
import Rights from '../components/menu/authority/Rights.vue'
import Roles from '../components/menu/authority/Roles.vue'
import notFound from '../components/404.vue'
Vue.use(Router)

const router = new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      redirect: '/login'
    },
    {
      path: '/login',
      component: Login
    },
    {
      path: '/home',
      component: Home,
      redirect: '/home/welcome',
      children: [
        { path: '/home/welcome', component: Welcome },
        { path: '/home/users', component: Users },
        { path: '/home/orders', component: Orders },
        { path: '/home/reports', component: Record },
        { path: '/home/categories', component: Categories },
        { path: '/home/goods', component: Goods },
        { path: '/home/params', component: Params },
        { path: '/home/rights', component: Rights },
        { path: '/home/roles', component: Roles }
      ]
    },
    {
      path: '*',
      component: notFound
    }
  ]
})

export default router
